package com.leyou.order.config;

import com.leyou.common.utils.IdWorker;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 虎哥
 */
@Data
@Configuration
@ConfigurationProperties("ly.worker")
public class IdWorkerConfig {

    private int workerId;
    private int dataCenterId;

    @Bean
    public IdWorker idWorker(){
        return new IdWorker(workerId, dataCenterId);
    }
}
